
<script type="text/javascript">
$(document).ready(function() {

	$('a[id^=delete_]').click(function() 
	{
		var ids = $(this).attr('id').split('_');
		$('#userValue').val(ids[1])
		$('#dialog').dialog('open');
	});

	$("#dialog").dialog({
		bgiframe: true,
		autoOpen: false,
		width: 300,
		modal: true,
		title : 'Eliminar usuario',
		buttons: {
			'Enviar': function() {
					
					window.location = "/admin/index/deleteuser/category/<?=$this->category ?>/user/"+$('#userValue').val();
				},
			'Cerrar': function() {
				$(this).dialog('close');
			}
		},	
	
	});
	
	$("#list").tablesorter({widthFixed: true, widgets: ['zebra'],headers: {0: {sorter: false }, 3: {sorter: false}}}).tablesorterPager({container: $("#pager")});
});	

</script>
<input type="hidden" id="userValue" value="" >
<div id="dialog">
	<br/><br/>
	<p>Est&aacute; seguro que desea eliminar el usuario?</p>
</div>
                <!-- h2 stays for breadcrumbs -->
                <h2><a href="#">Usuarios</a> &raquo; <a href="#" class="active">Listar usuarios</a></h2>
                
                <div id="main">
					<h3><a href="/admin/index">Raiz</a> &raquo; <?=$this->categoryName ?></h3>
					<div id="buttonAdd"><a href="/admin/index/newuser"><img style="vertical-align : middle;" src="/images/icons/add.png" />&nbsp;Nuevo usuario</a></div>
                    <table cellpadding="0" cellspacing="0" id="list" class="tablesorter">
						<thead>
						<tr>
							<th></th>
							<th>Nombre</th>
							<th>Email</th>
							<th></th>
						</tr>	
						</thead>
						<tbody>
							 <? $i = 0;?>
							       <?if ( count($this->users) == 0 ):?>
      									<tr></tr>
      							   <?endif;?>
      							   	
      							<?foreach( $this->users as $u ):?>
      							<?
      								if ( $i%2  == 1 )
      								{
      									$class = "odd";
      								} 
      								else
      								{
      									$class = "";
      								}	
      								$i++;
      							?>  
							<tr class="<?=$class ?>">
								<td style="padding-left : 5px"><img style="vertical-align : middle;" src="/images/icons/page_white.png" /></td>
                                <td ><a  href="#"><?=$u['name']." ". $u['last_name']?></a></td>
                                <td ><a  href="#"><?=$u['email']?></a></td>
                                <td class="action"><a title="Editar Usuario" href="/admin/index/edituser/user/<?=$u['id'] ?>" class="edit"><img src="/images/icons/pencil.png" style="vertical-align : middle;" alt="edit"  border=0 /></a><a title="Eliminar Usuario" id="delete_<?=$u['id'] ?>" href="#"> <img style="vertical-align : middle;" src="/images/icons/delete.png" alt="remove"  border=0 /></a></td>
                            </tr>       
                            <?endforeach?>                  
						</tbody>	                        
                        </table>
                        <div id="pager" class="pager">
						<form>
							<a href="#" class="first"><img border=0 src="/img/iomanager/icons/go-first.png" /></a>
							<a href="#" class="prev"><img border=0  src="/img/iomanager/icons/go-previous.png" /></a>
							<span class="pagedisplay"></span>
							<a href="#" class="next"><img border=0 src="/img/iomanager/icons/go-next.png" /></a>
							<a href="#" class="last"><img border=0  src="/img/iomanager/icons/go-last.png" /></a>
							<select class="pagesize">
								<option selected="selected"  value="10">10</option>
								<option value="20">20</option>
								<option value="50">50</option>
								<option  value="100">100</option>
							</select>
						</form>
						</div>
					
                </div>
                <!-- // #main -->
                
                <div class="clear"></div>